#import <UIKit/UIKit.h>
#import <AudioToolbox/AudioToolbox.h>
extern "C"
{
    void SingleVibration(int adType) {
        UIImpactFeedbackStyle type = UIImpactFeedbackStyleLight;
        if (adType == 1) {
            type = UIImpactFeedbackStyleLight;
        } else if (adType == 2) {
            type = UIImpactFeedbackStyleMedium;
        } else if (adType == 3) {
            type = UIImpactFeedbackStyleHeavy;
        } else if (adType == 4) {
            if (@available(iOS 13.0, *)) {
                type = UIImpactFeedbackStyleSoft;
            }
        } else if (adType == 5) {
            if (@available(iOS 13.0, *)) {
                type = UIImpactFeedbackStyleRigid;
            }
        }
        UIImpactFeedbackGenerator *r = [[UIImpactFeedbackGenerator alloc] initWithStyle:type];
        [r prepare];
        [r impactOccurred];
    }
    
    void ShakingVibration(int adType){
       AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);    //持续震动
        UINotificationFeedbackType type = UINotificationFeedbackTypeWarning;
        if (adType == 1) {
            type = UINotificationFeedbackTypeSuccess;
        } else if (adType == 2) {
            type = UINotificationFeedbackTypeWarning;
        } else if (adType == 3) {
            type = UINotificationFeedbackTypeError;
        } else if (adType == 4) {
        }
        UINotificationFeedbackGenerator *r = [[UINotificationFeedbackGenerator alloc] init];
        [r notificationOccurred:type];
    }
}


